
import * as types from './ActionTypes.js';
import { createAction } from 'redux-actions';
import { fetchRequest, JsonFetch } from '../util/fetch';

export const ShowoPostion = createAction(types.SEL_POSTION, (data) => {        //根据ID获取到推荐职位列表

    return fetchRequest('Postion/selPostion.go', 'POST', data);
});

export const SelposMobAction = createAction(types.SEL_POSMOB, (data) => {        //按条件查询
    return JsonFetch('Postion/selPosMob.go', 'POST', data);
});


export const ShowoNewPostion = createAction(types.SEL_NEWPOSTION, (data) => {        //根据ID获取到最新职位列表

    return fetchRequest('Postion/selPostion.go?page=' + data.page + '', 'GET');
});

export const ShowoCompany = createAction(types.SEL_COMPANY, (data) => {        //根据ID获取到公司列表

    return fetchRequest('CompanyInfo/selAllMob.go', 'GET');
});

//职位详情
export const SelPosInfoAction = createAction(types.SEL_POSTIONINFO_MOB, (data) => {
    return fetchRequest('Postion/selPostionInfoMob.go', 'POST', data);
});

//感兴趣的职位
export const SelInfoByNameAction = createAction(types.SEL_INTERESTING_MOB, (data) => {
    return fetchRequest('Postion/selInfoByNameMob.go', 'POST', data);
});

//公司详情
export const SelCompanyInfoAction = createAction(types.SEL_COMPANYINFO_MOB, (data) => {
    return fetchRequest('CompanyInfo/selCompanyInfoMob.go', 'POST', data);
});

//职位收藏
export const InsertCollectAction = createAction(types.INSERT_COLLECT_MOB, (data) => {
    return fetchRequest('Postion/insertCollectMob.go', 'POST', data);
});

//删除收藏
export const DeleteCollectAction = createAction(types.DELETE_COLLECT_MOB, (data) => {
    return fetchRequest('Postion/deleteCollectMob.go', 'POST', data);
});

//公司热招职位
export const SelPostionCompanyIdAction = createAction(types.SEL_POSTION_COMPANYID_MOB, (data) => {
    return fetchRequest('Postion/selByCompanyIdMob.go', 'POST', data);
});

//关注公司
export const InsertFollowCompanyAction = createAction(types.INSERTSELECTIVE, (data) => {
    return fetchRequest('CompanyInfo/insertSelective.go', 'POST', data);
});

//取消关注公司
export const DeleteFollowBykeyMob = createAction(types.DELETEFOLLOWBYKEYMOB, (data) => {
    return fetchRequest('CompanyInfo/deleteFollowByKeyMob.go', 'POST', data);
});

//根据公司经营范围查询职位
export const SelpostionByFieldAcion = createAction(types.SEL_POSTION_INDEX_MOB, (data) => {
    return fetchRequest('Postion/selPostionIndexMob.go', 'POST', data);
});